\hypertarget{group___timer_counter}{
\section{TimerCounter}
\label{group___timer_counter}\index{TimerCounter@{TimerCounter}}
}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{group___timer_counter_ga6617a30ded5d745873f7de678030d10c}{timer\_\-init} (int timer, int mode)
\item 
void \hyperlink{group___timer_counter_gae17f36dbe5d10ebced7a88cc463a7ea9}{timer\_\-load} (int timer, int value)
\item 
void \hyperlink{group___timer_counter_ga41884d7120e9408d1c5719e2858f6564}{mili\_\-sleep} (int mili)
\item 
void \hyperlink{group___timer_counter_ga0e9d3dc8f167970fe922c56d47d84850}{sec\_\-sleep} (int secs)
\end{DoxyCompactItemize}
\subsection*{Timer Address}
\label{_amgrp6e55b863430fd8bd7e27be8ff21ed918}
 \begin{DoxyCompactItemize}
\item 
\hypertarget{group___timer_counter_gacc9ff9df4a9674a1ce9ba08fc4a4679e}{
\#define \hyperlink{group___timer_counter_gacc9ff9df4a9674a1ce9ba08fc4a4679e}{TIMER\_\-0}~0x40}
\label{group___timer_counter_gacc9ff9df4a9674a1ce9ba08fc4a4679e}

\begin{DoxyCompactList}\small\item\em Adress of Timer0 divider. \item\end{DoxyCompactList}\item 
\hypertarget{group___timer_counter_gac62c99c2a9289891c1b83052242cca49}{
\#define \hyperlink{group___timer_counter_gac62c99c2a9289891c1b83052242cca49}{TIMER\_\-1}~0x41}
\label{group___timer_counter_gac62c99c2a9289891c1b83052242cca49}

\begin{DoxyCompactList}\small\item\em Adress of Timer1 divider. \item\end{DoxyCompactList}\item 
\hypertarget{group___timer_counter_ga1f34f18ad0ab8cace46b615773b48735}{
\#define \hyperlink{group___timer_counter_ga1f34f18ad0ab8cace46b615773b48735}{TIMER\_\-2}~0x42}
\label{group___timer_counter_ga1f34f18ad0ab8cace46b615773b48735}

\begin{DoxyCompactList}\small\item\em Adress of Timer2 divider. \item\end{DoxyCompactList}\item 
\hypertarget{group___timer_counter_ga282832448fb0281ef53d243c1cd48491}{
\#define \hyperlink{group___timer_counter_ga282832448fb0281ef53d243c1cd48491}{TIMER\_\-CTRL}~0x43}
\label{group___timer_counter_ga282832448fb0281ef53d243c1cd48491}

\begin{DoxyCompactList}\small\item\em The address of the timer control register. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Speaker and Timer2 control and bit meanings}
\label{_amgrp522b10e3c0ddf497a8490aaa34435a31}
 \begin{DoxyCompactItemize}
\item 
\hypertarget{group___timer_counter_ga51b3a5e3d4811ca063fe25e35560ab40}{
\#define \hyperlink{group___timer_counter_ga51b3a5e3d4811ca063fe25e35560ab40}{SPEAKER\_\-CTRL}~0x61}
\label{group___timer_counter_ga51b3a5e3d4811ca063fe25e35560ab40}

\begin{DoxyCompactList}\small\item\em The address of a generic PC register, whose bits 0 and 1 control the timer2 clock and output to the speaker. \item\end{DoxyCompactList}\item 
\hypertarget{group___timer_counter_ga2b2c87cf384febed61fa7cc3a039c692}{
\#define \hyperlink{group___timer_counter_ga2b2c87cf384febed61fa7cc3a039c692}{TIMER2\_\-ENABLE}~(1 $<$$<$ 0)}
\label{group___timer_counter_ga2b2c87cf384febed61fa7cc3a039c692}

\begin{DoxyCompactList}\small\item\em Enable Timer 2 clock. \item\end{DoxyCompactList}\item 
\hypertarget{group___timer_counter_gaddc08f0751fd696a4a21d7e20ce96765}{
\#define \hyperlink{group___timer_counter_gaddc08f0751fd696a4a21d7e20ce96765}{SPEAKER\_\-ENABLE}~(1 $<$$<$ 1)}
\label{group___timer_counter_gaddc08f0751fd696a4a21d7e20ce96765}

\begin{DoxyCompactList}\small\item\em Enable Timer 2 output to speaker. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Some usefull (and nice) definitions}
\label{_amgrp03a7b5ea01a04131b249a391645b3d29}
 \begin{DoxyCompactItemize}
\item 
\hypertarget{group___timer_counter_gae5af43ac16a34537dd1799ef08229aef}{
\#define \hyperlink{group___timer_counter_gae5af43ac16a34537dd1799ef08229aef}{TIMER\_\-CLK}~1193181}
\label{group___timer_counter_gae5af43ac16a34537dd1799ef08229aef}

\begin{DoxyCompactList}\small\item\em The timers input frequency. \item\end{DoxyCompactList}\item 
\hypertarget{group___timer_counter_gaea17a229fcf743540b24e8acde7b3a8f}{
\#define \hyperlink{group___timer_counter_gaea17a229fcf743540b24e8acde7b3a8f}{LCOM\_\-MODE}~0x36}
\label{group___timer_counter_gaea17a229fcf743540b24e8acde7b3a8f}

\begin{DoxyCompactList}\small\item\em Control byte: LSB followed by MSB, mode 3, binary count. \item\end{DoxyCompactList}\item 
\hypertarget{group___timer_counter_gacb14513edfabace28d9ee211c29b3a54}{
\#define \hyperlink{group___timer_counter_gacb14513edfabace28d9ee211c29b3a54}{LSB}(i)~((i) \& 0xFF)}
\label{group___timer_counter_gacb14513edfabace28d9ee211c29b3a54}

\begin{DoxyCompactList}\small\item\em The Least Significative Byte of a Word. \item\end{DoxyCompactList}\item 
\hypertarget{group___timer_counter_ga100824284a4b3301df9cdd3f49914fde}{
\#define \hyperlink{group___timer_counter_ga100824284a4b3301df9cdd3f49914fde}{MSB}(i)~((i) $>$$>$ 8)}
\label{group___timer_counter_ga100824284a4b3301df9cdd3f49914fde}

\begin{DoxyCompactList}\small\item\em The Most Significative Byte of a Word. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Timer-\/Counter definitions 

\subsection{Function Documentation}
\hypertarget{group___timer_counter_ga41884d7120e9408d1c5719e2858f6564}{
\index{TimerCounter@{TimerCounter}!mili\_\-sleep@{mili\_\-sleep}}
\index{mili\_\-sleep@{mili\_\-sleep}!TimerCounter@{TimerCounter}}
\subsubsection[{mili\_\-sleep}]{\setlength{\rightskip}{0pt plus 5cm}void mili\_\-sleep (int {\em mili})}}
\label{group___timer_counter_ga41884d7120e9408d1c5719e2858f6564}
Wait mili miliseconds, indirectly counting T0 interrupts \hypertarget{group___timer_counter_ga0e9d3dc8f167970fe922c56d47d84850}{
\index{TimerCounter@{TimerCounter}!sec\_\-sleep@{sec\_\-sleep}}
\index{sec\_\-sleep@{sec\_\-sleep}!TimerCounter@{TimerCounter}}
\subsubsection[{sec\_\-sleep}]{\setlength{\rightskip}{0pt plus 5cm}void sec\_\-sleep (int {\em secs})}}
\label{group___timer_counter_ga0e9d3dc8f167970fe922c56d47d84850}
wait secs seconds, indirectly counting T0 interrupts \hypertarget{group___timer_counter_ga6617a30ded5d745873f7de678030d10c}{
\index{TimerCounter@{TimerCounter}!timer\_\-init@{timer\_\-init}}
\index{timer\_\-init@{timer\_\-init}!TimerCounter@{TimerCounter}}
\subsubsection[{timer\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}void timer\_\-init (int {\em timer}, \/  int {\em mode})}}
\label{group___timer_counter_ga6617a30ded5d745873f7de678030d10c}
Program timer (0,1,2) with mode \hypertarget{group___timer_counter_gae17f36dbe5d10ebced7a88cc463a7ea9}{
\index{TimerCounter@{TimerCounter}!timer\_\-load@{timer\_\-load}}
\index{timer\_\-load@{timer\_\-load}!TimerCounter@{TimerCounter}}
\subsubsection[{timer\_\-load}]{\setlength{\rightskip}{0pt plus 5cm}void timer\_\-load (int {\em timer}, \/  int {\em value})}}
\label{group___timer_counter_gae17f36dbe5d10ebced7a88cc463a7ea9}
Load timer (0,1,2) with value 